<template>
<div class="factory-delivery">
  <el-tabs v-model="tabValue" @tab-click="documentProcessChoose">
    <el-tab-pane label="发货通知单" name="1">
      <noticeOfDeliveryVue ref="nd" :bus="bus" :fromDTab="fromDTab" :editable="tabOne" :data="data.documentProcess_fd_notice"></noticeOfDeliveryVue>
    </el-tab-pane>
    <el-tab-pane  label="出厂确认" name="2">
      <factoryConfirmationVue :bus="bus"  :editable="tabTwo" :data="data.documentProcess_fd_confirm"></factoryConfirmationVue>
    </el-tab-pane>
  </el-tabs>
</div>
</template>

<script>
import noticeOfDeliveryVue from './components/noticeOfDeliveryVue.vue'
import factoryConfirmationVue from './components/factoryConfirmationVue.vue'

export default {
  created(){
    let _this = this;
    this.bus.$on('bind-new-ftc', function () {
      _this.hasBind = true;
      _this.$forceUpdate();
    });
  },
  updated(){
  },
  watch: {
    fromDTab(){
      this.$refs.nd.$forceUpdate();
    }
  },
  components: {
    noticeOfDeliveryVue,
    factoryConfirmationVue
  },
  data() {
    return {
      tabValue: '1',
      clickTimes: 0,
      hasBind: false,
    }
  },
  props: {
    data: {
      type: Object,
      required: true
    },
    tabOne: {
      type: Boolean,
      required: true
    },
    tabTwo: {
      type: Boolean,
      required: true
    },
    bus: {
      type: Object,
      required: true
    },
    fromDTab: {
      type: Boolean,
      required: true
    }
  },
  methods: {
    documentProcessChoose(index, event) {
    }
  }
}
</script>

<style scoped lang="scss">
.factory-delivery {
}
</style>
